<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	/* 无参无返回值 */
		function fn1(){
		alert("无参无返回值 fn1调用了")
	} 
	//调用fn1
	//fn1();	
	
	
	/*  有参有返回值*/
	function fn2(name,age){
		alert(name+":"+age);
	}
	//fn2("吴杨柳",28);
	
	
	/*  无参有返回值*/
	function fn3(){
		return "abc";
	}
   //var s = fn3();
   //alert(s);

	/* 有参有返回值 */
	function fn4(x,y){
		return x+y;
	}
	//var result = fn4(20,8);              //result: 结果
	//alert(result);
	
	
	
	/*第二种方式*/
	var fn5 = function(x,y){
		return x+y;
	}
	//var result =fn5(20,8);
	//alert(result);
	
	
	
	
	/* 第三种方式 */
	var fn6 = new Function("x","y","return x+y");
	var result = fn6(2,8);
	//alert(result)
	
	
	
</script>
</head>
<body>
 <input type="button" value="按钮" onclick="fn2('王璐',20)">
</body>
</html>